SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the UserType table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.UserType_Find
(

	@SearchUsingOR bit   = null ,

	@Id int   = null ,

	@Title nvarchar (50)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [Title]
    FROM
	[dbo].[UserType]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([Title] = @Title OR @Title IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [Title]
    FROM
	[dbo].[UserType]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([Title] = @Title AND @Title is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
